﻿using System;
using System.Collections;
using System.Web.UI;
using System.Web.UI.WebControls;

using Model;
using Model.Components;
using FrameWork.Components;
using FrameWork.WebControls;

namespace FrameWork.web.Manager.Module.Tousu.Zhengfu
{
    public partial class Manager : System.Web.UI.Page
    {
        public Int32 IDX = (Int32)Common.sink("IDX", MethodType.Get, 10, 0, DataType.Int);
        string CMD = (string)Common.sink("CMD", MethodType.Get, 10, 1, DataType.Str);
        protected void Page_Load(object sender, EventArgs e)
        {
            FrameWorkPermission.CheckPagePermission(CMD);
            if (!Page.IsPostBack)
            {
                OnStart();
            }
        }

        /// <summary>
        /// 开始操作
        /// </summary>
        private void OnStart()
        {
            T_TouSuEntity ut = BusinessFacadeModel.T_TouSuDisp(IDX);
            OnStartData(ut);
            BindDep();
            switch (CMD)
            {
                case "New":
                    TabOptionItem1.Tab_Name = HeadMenuWebControls1.HeadOPTxt = "增加";
                    Hidden_Disp();
                    TID_Input.Text = "鲁环政" + Common.sRndNum(4);
                    bExp.Visible = false;
                    banli.Visible = false;
                    Button1.Visible = true;
                    break;
                case "List":
                    TabOptionItem1.Tab_Name = HeadMenuWebControls1.HeadOPTxt = "查看";
                    Hidden_Input();
                    Button1.Visible = false;
                    AddEditButton();
                    CheckPermission();
                    break;
                case "Edit":
                    TabOptionItem1.Tab_Name = HeadMenuWebControls1.HeadOPTxt = "修改";
                    Hidden_Disp();
                    AddDeleteButton();
                    break;
                case "Delete":
                    ut.DataTable_Action_ = DataTable_Action.Delete;
                    if (BusinessFacadeModel.T_TouSuInsertUpdateDelete(ut) > 0)
                    {
                        EventMessage.MessageBox(1, "删除成功", string.Format("删除ID:{0}成功!", IDX), Icon_Type.OK, Common.GetHomeBaseUrl("Default.aspx"));
                    }
                    else
                    {
                        EventMessage.MessageBox(1, "删除失败", string.Format("删除ID:{0}失败!", IDX), Icon_Type.Error, Common.GetHomeBaseUrl("Default.aspx"));
                    }
                    break;
                default:
                    EventMessage.MessageBox(2, "不存在操作字符串!", "不存在操作字符串!", Icon_Type.Error, Common.GetHomeBaseUrl("Default.aspx"));
                    break;
            }
        }

        private void BindDep()
        {
            QueryParam qp = new QueryParam();
            int RecordCount = 0;
            qp.OrderType = 0;
            qp.Where = string.Format("Where G_ParentID =1 and G_Delete=0 ");
            ArrayList lst = BusinessFacade.sys_GroupList(qp, out RecordCount);
            foreach (sys_GroupTable var in lst)
            {
                ListItem myListItem = new ListItem(var.G_CName, var.GroupID.ToString());
                this.BChuliGroup_Input.Items.Add(myListItem);
                RecordCount++;
            }
        }

        private void CheckPermission()
        {
            string zhuangtai = BusinessFacade.get_table_fileds("T_Tousu", "zhuangtai", "ID", IDX.ToString());
            if (zhuangtai == "未处理")
            {
                if (FrameWorkPermission.CheckButtonPermission(PopedomType.Orderby))// 政政办
                {
                    bXinfang.Visible = true;
                    btoLingdao.Visible = true;

                    ShowInput();
                    //Hidden_Disp();
                    Afujian_Disp.Visible = true;
                    BXianCon_Input.Visible = false;
                    BLingdao_Input.Visible = false;
                    bxian.Visible = false;
                }
            }

            if (zhuangtai == "退回")
            {
                if (FrameWorkPermission.CheckButtonPermission(PopedomType.Orderby))// 政政办
                {
                    bXinfang.Visible = true;
                    btoLingdao.Visible = true;

                    ShowInput();
                    //Hidden_Disp();
                    BXianCon_Input.Visible = false;
                    BLingdao_Input.Visible = false;
                    bxian.Visible = false;
                }
            }


            if (zhuangtai == "领导审批")
            {

                if (FrameWorkPermission.CheckButtonPermission(PopedomType.Print))//局长
                {
                    bLingdao.Visible = true;

                    ShowInput();
                    //Hidden_Disp();
                    BXianCon_Input.Visible = false;
                    BXinfang_Input.Visible = false;
                    bxian.Visible = false;
                    bXinfang.Visible = false;
                }

            }

            if (zhuangtai == "办理中")
            {

                if (FrameWorkPermission.CheckButtonPermission(PopedomType.A))//县市区
                {
                    bxian.Visible = true;
                    bback.Visible = true;

                    Hidden_Input();
                    BXianCon_Input.Visible = true;
                }
            }

            if (zhuangtai == "办结")
            {


            }
        }

        private void ShowInput()
        {
            BWentiType_Input.Visible = true;
            BXianCon_Input.Visible = true;
            BXinfang_Input.Visible = true;
            BLingdao_Input.Visible = true;
            BSumDay_Input.Visible = true;
            BChuliGroup_Input.Visible = true;
            BChaoSong_Input.Visible = true;
            BXieban_Input.Visible = true;
            button3.Visible = true;
        }

        /// <summary>
        /// 增加修改按钮
        /// </summary>
        private void AddEditButton()
        {
            HeadMenuButtonItem bi = new HeadMenuButtonItem();
            bi.ButtonPopedom = PopedomType.Edit;
            bi.ButtonName = "";
            bi.ButtonUrl = string.Format("?CMD=Edit&IDX={0}", IDX);
            HeadMenuWebControls1.ButtonList.Add(bi);
        }


        /// <summary>
        /// 增加删除按钮
        /// </summary>
        private void AddDeleteButton()
        {
            HeadMenuButtonItem bi = new HeadMenuButtonItem();
            bi.ButtonPopedom = PopedomType.Delete;
            bi.ButtonName = "";
            bi.ButtonUrlType = UrlType.JavaScript;
            bi.ButtonUrl = string.Format("DelData('?CMD=Delete&IDX={0}')", IDX);
            HeadMenuWebControls1.ButtonList.Add(bi);

            HeadMenuButtonItem bi1 = new HeadMenuButtonItem();
            bi1.ButtonPopedom = PopedomType.List;
            bi1.ButtonIcon = "back.gif";
            bi1.ButtonName = "返回";
            bi1.ButtonUrl = string.Format("?CMD=List&IDX={0}", IDX);
            HeadMenuWebControls1.ButtonList.Add(bi1);
        }

        /// <summary>
        /// 初始化数据
        /// </summary>
        /// <param name="ut"></param>
        private void OnStartData(T_TouSuEntity ut)
        {

            TID_Input.Text = TID_Disp.Text = ut.TID.ToString();
            ALaiyuan_Input.Text = ALaiyuan_Disp.Text = ut.ALaiyuan.ToString();
            AzhuanbanID_Input.Text = AzhuanbanID_Disp.Text = ut.AzhuanbanID.ToString();
            AzhuanfangTime_Input.Text = AzhuanfangTime_Disp.Text = Common.ConvertDate(ut.AzhuanfangTime).ToString();
            ALiFangname_Input.Text = ALiFangname_Disp.Text = ut.ALiFangname.ToString();
            ALaifangTime_Input.Text = ALaifangTime_Disp.Text = Common.ConvertDate(ut.ALaifangTime).ToString();
            AID_Input.Text = AID_Disp.Text = ut.AID.ToString();
            APhone_Input.Text = APhone_Disp.Text = ut.APhone.ToString();
            AlaifangGroup_Input.Text = AlaifangGroup_Disp.Text = ut.AlaifangGroup.ToString();
            Alaifangzhuzhi_Input.Text = Alaifangzhuzhi_Disp.Text = ut.Alaifangzhuzhi.ToString();
            Alaifangpostcode_Input.Text = Alaifangpostcode_Disp.Text = ut.Alaifangpostcode.ToString();
            Abeitousudanw_Input.Text = Abeitousudanw_Disp.Text = ut.Abeitousudanw.ToString();
            AbeitousuName_Input.Text = AbeitousuName_Disp.Text = ut.AbeitousuName.ToString();
            Afanyingwenti_Input.Text = Afanyingwenti_Disp.Text = ut.Afanyingwenti.ToString();
            AdiyiciTime_Input.Text = AdiyiciTime_Disp.Text = Common.ConvertDate(ut.AdiyiciTime).ToString();
            Asunshi_Input.Text = Asunshi_Disp.Text = ut.Asunshi.ToString();
            Azhinengbumen_Input.Text = Azhinengbumen_Disp.Text = ut.Azhinengbumen.ToString();
            ATimeAndGroup_Input.Text = ATimeAndGroup_Disp.Text = ut.ATimeAndGroup.ToString();
            AfanyingTime_Input.Text = AfanyingTime_Disp.Text = Common.ConvertDate(ut.AfanyingTime).ToString();
            Achuliqingkuang_Input.Text = Achuliqingkuang_Disp.Text = ut.Achuliqingkuang.ToString();
            ADafu_Input.Text = ADafu_Disp.Text = ut.ADafu.ToString();
            AShenqingfucha_Input.Text = AShenqingfucha_Disp.Text = ut.AShenqingfucha.ToString();
            AfuchaTime_Input.Text = AfuchaTime_Disp.Text = Common.ConvertDate(ut.AfuchaTime).ToString();
            AShiyijian_Input.Text = AShiyijian_Disp.Text = ut.AShiyijian.ToString();
            Axinfangbanyijian_Input.Text = Axinfangbanyijian_Disp.Text = ut.Axinfangbanyijian.ToString();
            AlingdaoYijian_Input.Text = AlingdaoYijian_Disp.Text = ut.AlingdaoYijian.ToString();
            Azhuanchu_Input.Text = Azhuanchu_Disp.Text = ut.Azhuanchu.ToString();
            AzhuanchuTime_Input.Text = AzhuanchuTime_Disp.Text = Common.ConvertDate(ut.AzhuanchuTime).ToString();
            AyaoqiuTime_Input.Text = AyaoqiuTime_Disp.Text = ut.AyaoqiuTime.ToString();
            Ajieguo_Input.Text = Ajieguo_Disp.Text = ut.Ajieguo.ToString();
            Ajiluren_Input.Text = Ajiluren_Disp.Text = ut.Ajiluren.ToString();
            AjilushiTime_Input.Text = AjilushiTime_Disp.Text = Common.ConvertDate(ut.AjilushiTime).ToString();

            if ((ut.Afujian + "").Trim() != "")
            {
                Afujian_Disp.Text = ut.Afujian;
                Afujian_Disp.NavigateUrl = string.Format("~/Manager/Public/UserPhoto/{0}", ut.Afujian);

            }
            BWentiType_Input.Value = BWentiType_Disp.Text = ut.BWentiType.ToString();
            BXianCon_Input.Text = BXianCon_Disp.Text = ut.BXianCon.ToString();
            BXinfang_Input.Text = BXinfang_Disp.Text = ut.BXinfang.ToString();
            BLingdao_Input.Text = BLingdao_Disp.Text = ut.BLingdao.ToString();
            BSumDay_Disp.Text = ut.BSumDay.ToString();

            BChuliGroup_Input.Text = ut.BChuliGroup.ToString();
            BChuliGroup_Disp.Text = BusinessFacade.sys_GroupDisp(ut.BChuliGroup).G_CName;
            BChaoSong_Input.Text = BChaoSong_Disp.Text = ut.BChaoSong.ToString();
            BXieban_Input.Text = BXieban_Disp.Text = ut.BXieban.ToString();
            BIF_Disp.Text = ut.BIF.ToString();


        }

        private string upLoad()
        {
            FileUpLoadCommon fc = new FileUpLoadCommon(Common.UpLoadDir + "UserPhoto/", false);
            fc.SaveFile(Afujian_Input, false);
            return fc.newFileName;
        }


        /// <summary>
        /// 隐藏输入框
        /// </summary>
        private void Hidden_Input()
        {
            TID_Input.Visible = false;
            ALaiyuan_Input.Visible = false;
            AzhuanbanID_Input.Visible = false;
            AzhuanfangTime_Input.Visible = false;
            ALiFangname_Input.Visible = false;
            ALaifangTime_Input.Visible = false;
            AID_Input.Visible = false;
            APhone_Input.Visible = false;
            AlaifangGroup_Input.Visible = false;
            Alaifangzhuzhi_Input.Visible = false;
            Alaifangpostcode_Input.Visible = false;
            Abeitousudanw_Input.Visible = false;
            AbeitousuName_Input.Visible = false;
            Afanyingwenti_Input.Visible = false;
            AdiyiciTime_Input.Visible = false;
            Asunshi_Input.Visible = false;
            Azhinengbumen_Input.Visible = false;
            ATimeAndGroup_Input.Visible = false;
            AfanyingTime_Input.Visible = false;
            Achuliqingkuang_Input.Visible = false;
            ADafu_Input.Visible = false;
            AShenqingfucha_Input.Visible = false;
            AfuchaTime_Input.Visible = false;
            AShiyijian_Input.Visible = false;
            Axinfangbanyijian_Input.Visible = false;
            AlingdaoYijian_Input.Visible = false;
            Azhuanchu_Input.Visible = false;
            AzhuanchuTime_Input.Visible = false;
            AyaoqiuTime_Input.Visible = false;
            Ajieguo_Input.Visible = false;
            Ajiluren_Input.Visible = false;
            AjilushiTime_Input.Visible = false;
            Afujian_Input.Visible = false;
            BWentiType_Input.Visible = false;
            BXianCon_Input.Visible = false;
            BXinfang_Input.Visible = false;
            BLingdao_Input.Visible = false;
            BSumDay_Input.Visible = false;
            BChuliGroup_Input.Visible = false;
            BChaoSong_Input.Visible = false;
            BXieban_Input.Visible = false;
        }

        /// <summary>
        /// 隐藏显示框
        /// </summary>
        private void Hidden_Disp()
        {
            TID_Disp.Visible = false;
            ALaiyuan_Disp.Visible = false;
            AzhuanbanID_Disp.Visible = false;
            AzhuanfangTime_Disp.Visible = false;
            ALiFangname_Disp.Visible = false;
            ALaifangTime_Disp.Visible = false;
            AID_Disp.Visible = false;
            APhone_Disp.Visible = false;
            AlaifangGroup_Disp.Visible = false;
            Alaifangzhuzhi_Disp.Visible = false;
            Alaifangpostcode_Disp.Visible = false;
            Abeitousudanw_Disp.Visible = false;
            AbeitousuName_Disp.Visible = false;
            Afanyingwenti_Disp.Visible = false;
            AdiyiciTime_Disp.Visible = false;
            Asunshi_Disp.Visible = false;
            Azhinengbumen_Disp.Visible = false;
            ATimeAndGroup_Disp.Visible = false;
            AfanyingTime_Disp.Visible = false;
            Achuliqingkuang_Disp.Visible = false;
            ADafu_Disp.Visible = false;
            AShenqingfucha_Disp.Visible = false;
            AfuchaTime_Disp.Visible = false;
            AShiyijian_Disp.Visible = false;
            Axinfangbanyijian_Disp.Visible = false;
            AlingdaoYijian_Disp.Visible = false;
            Azhuanchu_Disp.Visible = false;
            AzhuanchuTime_Disp.Visible = false;
            AyaoqiuTime_Disp.Visible = false;
            Ajieguo_Disp.Visible = false;
            Ajiluren_Disp.Visible = false;
            AjilushiTime_Disp.Visible = false;
            Afujian_Disp.Visible = false;
            BWentiType_Disp.Visible = false;
            BXianCon_Disp.Visible = false;
            BXinfang_Disp.Visible = false;
            BLingdao_Disp.Visible = false;
            BSumDay_Disp.Visible = false;
            BChuliGroup_Disp.Visible = false;
            BChaoSong_Disp.Visible = false;
            BXieban_Disp.Visible = false;
            BIF_Disp.Visible = false;


        }

        /// <summary>
        /// 增加/修改事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button1_Click(object sender, EventArgs e)
        {
            string Type_Value = "来政";
            string TID_Value = (string)Common.sink(TID_Input.UniqueID, MethodType.Post, 200, 0, DataType.Str);
            string ALaiyuan_Value = (string)Common.sink(ALaiyuan_Input.UniqueID, MethodType.Post, 200, 0, DataType.Str);
            string AzhuanbanID_Value = (string)Common.sink(AzhuanbanID_Input.UniqueID, MethodType.Post, 200, 0, DataType.Str);

            DateTime? AzhuanfangTime_Value = (DateTime?)Common.sink(AzhuanfangTime_Input.UniqueID, MethodType.Post, 50, 0, DataType.Dat);

            string ALiFangname_Value = (string)Common.sink(ALiFangname_Input.UniqueID, MethodType.Post, 200, 0, DataType.Str);

            DateTime? ALaifangTime_Value = (DateTime?)Common.sink(ALaifangTime_Input.UniqueID, MethodType.Post, 50, 0, DataType.Dat);

            string AID_Value = (string)Common.sink(AID_Input.UniqueID, MethodType.Post, 200, 0, DataType.Str);
            string APhone_Value = (string)Common.sink(APhone_Input.UniqueID, MethodType.Post, 200, 0, DataType.Str);
            string AlaifangGroup_Value = (string)Common.sink(AlaifangGroup_Input.UniqueID, MethodType.Post, 200, 0, DataType.Str);
            string Alaifangzhuzhi_Value = (string)Common.sink(Alaifangzhuzhi_Input.UniqueID, MethodType.Post, 200, 0, DataType.Str);
            string Alaifangpostcode_Value = (string)Common.sink(Alaifangpostcode_Input.UniqueID, MethodType.Post, 200, 0, DataType.Str);
            string Abeitousudanw_Value = (string)Common.sink(Abeitousudanw_Input.UniqueID, MethodType.Post, 200, 0, DataType.Str);
            string AbeitousuName_Value = (string)Common.sink(AbeitousuName_Input.UniqueID, MethodType.Post, 200, 0, DataType.Str);
            string Afanyingwenti_Value = (string)Common.sink(Afanyingwenti_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);

            DateTime? AdiyiciTime_Value = (DateTime?)Common.sink(AdiyiciTime_Input.UniqueID, MethodType.Post, 50, 0, DataType.Dat);

            string Asunshi_Value = (string)Common.sink(Asunshi_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string Azhinengbumen_Value = (string)Common.sink(Azhinengbumen_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string ATimeAndGroup_Value = (string)Common.sink(ATimeAndGroup_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);

            DateTime? AfanyingTime_Value = (DateTime?)Common.sink(AfanyingTime_Input.UniqueID, MethodType.Post, 50, 0, DataType.Dat);

            string Achuliqingkuang_Value = (string)Common.sink(Achuliqingkuang_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string ADafu_Value = (string)Common.sink(ADafu_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string AShenqingfucha_Value = (string)Common.sink(AShenqingfucha_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);

            DateTime? AfuchaTime_Value = (DateTime?)Common.sink(AfuchaTime_Input.UniqueID, MethodType.Post, 50, 0, DataType.Dat);

            string AShiyijian_Value = (string)Common.sink(AShiyijian_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string Axinfangbanyijian_Value = (string)Common.sink(Axinfangbanyijian_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string AlingdaoYijian_Value = (string)Common.sink(AlingdaoYijian_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string Azhuanchu_Value = (string)Common.sink(Azhuanchu_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);

            DateTime? AzhuanchuTime_Value = (DateTime?)Common.sink(AzhuanchuTime_Input.UniqueID, MethodType.Post, 50, 0, DataType.Dat);

            string AyaoqiuTime_Value = (string)Common.sink(AyaoqiuTime_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string Ajieguo_Value = (string)Common.sink(Ajieguo_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string Ajiluren_Value = (string)Common.sink(Ajiluren_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);

            DateTime? AjilushiTime_Value = (DateTime?)Common.sink(AjilushiTime_Input.UniqueID, MethodType.Post, 50, 0, DataType.Dat);

            string Afujian_Value = upLoad();

            T_TouSuEntity ut = BusinessFacadeModel.T_TouSuDisp(IDX);

            ut.Type = Type_Value;
            ut.TID = TID_Value;
            ut.ALaiyuan = ALaiyuan_Value;
            ut.AzhuanbanID = AzhuanbanID_Value;
            ut.AzhuanfangTime = AzhuanfangTime_Value;
            ut.ALiFangname = ALiFangname_Value;
            ut.ALaifangTime = ALaifangTime_Value;
            ut.AID = AID_Value;
            ut.APhone = APhone_Value;
            ut.AlaifangGroup = AlaifangGroup_Value;
            ut.Alaifangzhuzhi = Alaifangzhuzhi_Value;
            ut.Alaifangpostcode = Alaifangpostcode_Value;
            ut.Abeitousudanw = Abeitousudanw_Value;
            ut.AbeitousuName = AbeitousuName_Value;
            ut.Afanyingwenti = Afanyingwenti_Value;
            ut.AdiyiciTime = AdiyiciTime_Value;
            ut.Asunshi = Asunshi_Value;
            ut.Azhinengbumen = Azhinengbumen_Value;
            ut.ATimeAndGroup = ATimeAndGroup_Value;
            ut.AfanyingTime = AfanyingTime_Value;
            ut.Achuliqingkuang = Achuliqingkuang_Value;
            ut.ADafu = ADafu_Value;
            ut.AShenqingfucha = AShenqingfucha_Value;
            ut.AfuchaTime = AfuchaTime_Value;
            ut.AShiyijian = AShiyijian_Value;
            ut.Axinfangbanyijian = Axinfangbanyijian_Value;
            ut.AlingdaoYijian = AlingdaoYijian_Value;
            ut.Azhuanchu = Azhuanchu_Value;
            ut.AzhuanchuTime = AzhuanchuTime_Value;
            ut.AyaoqiuTime = AyaoqiuTime_Value;
            ut.Ajieguo = Ajieguo_Value;
            ut.Ajiluren = Ajiluren_Value;
            ut.AjilushiTime = AjilushiTime_Value;
            ut.Afujian = Afujian_Value;
            ut.zhuangtai = "未处理";
            if (CMD == "New")
            {
                ut.DataTable_Action_ = DataTable_Action.Insert;
            }
            else if (CMD == "Edit")
            {
                ut.DataTable_Action_ = DataTable_Action.Update;
            }
            else
            {
                EventMessage.MessageBox(2, "不存在操作字符串!", "不存在操作字符串!", Icon_Type.Error, Common.GetHomeBaseUrl("Default.aspx"));
            }
            Int32 rInt = BusinessFacadeModel.T_TouSuInsertUpdateDelete(ut);
            if (rInt > 0)
            {
                string OpTxt = string.Format("增加办理成功!(ID:{0})", rInt);
                if (ut.DataTable_Action_ == DataTable_Action.Update)
                    OpTxt = string.Format("修改办理成功!(ID:{0})", IDX);
                EventMessage.MessageBox(1, "操作成功", OpTxt, Icon_Type.OK, Common.GetHomeBaseUrl("Default.aspx"));
            }
            else if (rInt == -2)
            {
                EventMessage.MessageBox(1, "操作失败", "操作失败,存在相同的键值(用户名/数据)!", Icon_Type.Alert, Common.GetHomeBaseUrl("Default.aspx"));
            }
            else
            {
                EventMessage.MessageBox(1, "操作失败", string.Format("操作失败,返回值:{0}!", rInt), Icon_Type.Error, Common.GetHomeBaseUrl("Default.aspx"));
            }
        }

        protected void Update()
        {

            string BWentiType_Value = (string)Common.sink(BWentiType_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string BXianCon_Value = (string)Common.sink(BXianCon_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string BXinfang_Value = (string)Common.sink(BXinfang_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string BLingdao_Value = (string)Common.sink(BLingdao_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string BSumDay_Value = (string)Common.sink(BSumDay_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);

            string BChaoSong_Value = (string)Common.sink(BChaoSong_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            string BXieban_Value = (string)Common.sink(BXieban_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            BusinessFacade.Update_Table_Fileds("T_Tousu", string.Format("BSumDay='{0}'", BSumDay_Value), string.Format("ID='{0}'", IDX.ToString()));
            BusinessFacade.Update_Table_Fileds("T_Tousu", string.Format("BWentiType='{0}'", BWentiType_Value), string.Format("ID='{0}'", IDX.ToString()));
            BusinessFacade.Update_Table_Fileds("T_Tousu", string.Format("BXianCon='{0}'", BXianCon_Value), string.Format("ID='{0}'", IDX.ToString()));
            BusinessFacade.Update_Table_Fileds("T_Tousu", string.Format("BXinfang='{0}'", BXinfang_Value), string.Format("ID='{0}'", IDX.ToString()));
            BusinessFacade.Update_Table_Fileds("T_Tousu", string.Format("BLingdao='{0}'", BLingdao_Value), string.Format("ID='{0}'", IDX.ToString()));
            BusinessFacade.Update_Table_Fileds("T_Tousu", string.Format("BChaoSong='{0}'", BChaoSong_Value), string.Format("ID='{0}'", IDX.ToString()));
            BusinessFacade.Update_Table_Fileds("T_Tousu", string.Format("BXieban='{0}'", BXieban_Value), string.Format("ID='{0}'", IDX.ToString()));
        }

        protected void bExp_Click(object sender, EventArgs e)
        {
            Response.Redirect(string.Format("../Exp.aspx?IDX={0}", IDX.ToString()));
        }

        protected void bXinfang_Click(object sender, EventArgs e)
        {
            string BSumDay_Value = (string)Common.sink(BSumDay_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            if (BSumDay_Value == "0")
            {
                EventMessage.MessageBox(2, "操作失败", string.Format("请输入要求办结上报时间!"), Icon_Type.Error, "history.back();", UrlType.JavaScript);
            }
            else
            {
                Update();
                Int32 BChuliGroup_Value = (Int32)Common.sink(BChuliGroup_Input.UniqueID, MethodType.Post, 500, 0, DataType.Int);
                BusinessFacade.Update_Table_Fileds("T_Tousu", string.Format("BEndDate='{0}'", DateTime.Now.AddDays(Convert.ToDouble(BSumDay_Value))), string.Format("ID='{0}'", IDX.ToString()));
                BusinessFacade.Update_Table_Fileds("T_Tousu", string.Format("zhuangtai='办理中'"), string.Format("ID='{0}'", IDX.ToString()));
                BusinessFacade.Update_Table_Fileds("T_Tousu", string.Format("BChuliGroup='{0}'", BChuliGroup_Input.SelectedItem.Value), string.Format("ID='{0}'", IDX.ToString()));
                EventMessage.MessageBox(1, "操作成功", "操作成功！", Icon_Type.OK, Common.GetHomeBaseUrl("Default.aspx"));
            }
        }

        protected void btoLingdao_Click(object sender, EventArgs e)
        {

        }

        protected void bLingdao_Click(object sender, EventArgs e)
        {
            Int32 XSumDay_Value = (Int32)Common.sink(BSumDay_Input.UniqueID, MethodType.Post, 10, 0, DataType.Int);
            if (XSumDay_Value == 0)
            {
                EventMessage.MessageBox(2, "操作失败", string.Format("请输入要求办结上报时间!"), Icon_Type.Error, "history.back();", UrlType.JavaScript);
            }
            else
            {
                Update();
                BusinessFacade.Update_Table_Fileds("T_Tousu", string.Format("BEndDate='{0}'", DateTime.Now.AddDays(Convert.ToDouble(XSumDay_Value))), string.Format("ID='{0}'", IDX.ToString()));
                BusinessFacade.Update_Table_Fileds("T_Tousu", string.Format("zhuangtai='办理中'"), string.Format("ID='{0}'", IDX.ToString()));
                BusinessFacade.Update_Table_Fileds("T_Tousu", string.Format("BChuliGroup='{0}'", BChuliGroup_Input.SelectedItem.Value), string.Format("ID='{0}'", IDX.ToString()));
                EventMessage.MessageBox(1, "操作成功", "操作成功！", Icon_Type.OK, Common.GetHomeBaseUrl("Default.aspx"));
            }
        }

        protected void bxian_Click(object sender, EventArgs e)
        {
            string BSumDay_Value = (string)Common.sink(BSumDay_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
            if (BSumDay_Value == "0")
            {
                EventMessage.MessageBox(2, "操作失败", string.Format("请输入要求办结上报时间!"), Icon_Type.Error, "history.back();", UrlType.JavaScript);
            }
            else
            {
                string BXianCon_Value = (string)Common.sink(BXianCon_Input.UniqueID, MethodType.Post, 500, 0, DataType.Str);
                BusinessFacade.Update_Table_Fileds("T_Tousu", string.Format("BXianCon='{0}'", BXianCon_Value), string.Format("ID='{0}'", IDX.ToString()));
                //Update();
                BusinessFacade.Update_Table_Fileds("T_Tousu", string.Format("zhuangtai='办结'"), string.Format("ID='{0}'", IDX.ToString()));
                BusinessFacade.Update_Table_Fileds("T_Tousu", string.Format("BIF='办理办结'"), string.Format("ID='{0}'", IDX.ToString()));
                EventMessage.MessageBox(1, "操作成功", "操作成功！", Icon_Type.OK, Common.GetHomeBaseUrl("Default.aspx"));
            }
        }


        protected void bback_Click(object sender, EventArgs e)
        {
            BusinessFacade.Update_Table_Fileds("T_Tousu", string.Format("zhuangtai='退回'"), string.Format("ID='{0}'", IDX.ToString()));

            EventMessage.MessageBox(1, "操作成功", "操作成功！", Icon_Type.OK, Common.GetHomeBaseUrl("Default.aspx"));
        }
    }
}
